__author__ = 'alex'

'''
def calc(n):
    print '-->',n
    if n/2 > 0:

        return  calc(n/2 )

    print '-------'
    return n
print calc(12)
'''

data_list = range(0,1000000, 2)

def binary_search(find_num,data):
    #5
    mid = len(data)/2  #100/2 = 50
    if mid >0:
        if find_num >data[mid] : #find num should be in right
            print "data should in right",mid #data[mid:]
            binary_search(find_num,data[mid:])
        elif find_num < data[mid]: # find num should be in left
            print "data should in left",mid #data[:mid]
            binary_search(find_num, data[:mid])
        else: # find num equals to mid
            print "find the num:%s" % data[mid]
    elif data[0] == find_n :
        print "\033[32;1mfind the num:%s\033[0m" % data[mid]

    else:
        print 'cannot find the num', find_n


if __name__ == '__main__':
    find_n = raw_input("find:").strip()
    if find_n.isdigit():
        find_n = int(find_n)
        binary_search(find_n, data_list)

        if find_n in data_list:
            print '--->%s exist in list'

